package club.vann.kafka.mock.controller;

import club.vann.kafka.mock.common.model.request.JsonRequest;
import club.vann.kafka.mock.common.model.request.StrategyParentActionRequest;
import club.vann.kafka.mock.service.strategy.StrategyService;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

@RequestMapping("/strategy")
@RequiredArgsConstructor
@RestController
@Slf4j
public class StrategyController extends BaseController {
  private final StrategyService strategyService;

  /** 模拟策略汇总数据推送。 */
  @PostMapping("/summary")
  public void summary(@RequestBody JsonRequest request) {
    log.info("推送策略汇总信息 {}", request);
    this.strategyService.strategySummaryInfo(request.getInfo());
  }

  /** 模拟策略指标数据推送。 */
  @PostMapping("/indicator")
  public void indicator(@RequestBody JsonRequest request) {
    log.info("推送策略指标信息");
    this.strategyService.strategyIndicator(request.getInfo());
  }

  /** 模拟策略指标数据推送。 */
  @PostMapping("/parent/action")
  public void parentAction(@RequestBody StrategyParentActionRequest request) {
    log.info("推送ParentAction信息");
    this.strategyService.parentAction(request);
  }
}
